package com.ds.infrastructure.hyperspace.console.model.response.containerconfig;

import com.ds.infrastructure.hyperspace.console.entity.table.TbContainerConfig;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.Map;

/**
 * @author: yaozhendong
 * @create: 2019-09-18 18:48
 **/
@Data
@NoArgsConstructor
public class ListContainerConfigVO {
    private Long id;

    private String stageName;

    private String proxyName;

    private String configNumber;

    private Integer editState;

    private String description;

    private Date gmtModified;

    private Date gmtCreate;

    public static ListContainerConfigVO toVO(TbContainerConfig entity, Map<Long, String> tbStageMap, Map<Long, String> tbProxyMap) {
        ListContainerConfigVO listContainerConfigVO = new ListContainerConfigVO();
        listContainerConfigVO.setId(entity.getId());
        listContainerConfigVO.setStageName(tbStageMap.get(entity.getStageId()));
        listContainerConfigVO.setProxyName(tbProxyMap.get(entity.getEnvironmentId()));
        listContainerConfigVO.setConfigNumber(entity.getConfigNumber());
        listContainerConfigVO.setEditState(entity.getEditState());
        listContainerConfigVO.setDescription(entity.getDescription());
        listContainerConfigVO.setGmtModified(entity.getGmtModified());
        listContainerConfigVO.setGmtCreate(entity.getGmtCreate());
        return listContainerConfigVO;
    }
}
